{% extends "catalog/base_generic.html" %}

{% block content %}
<div class="row">
  <div class="col-md-8">
    <h1>{{ author.last_name }}, {{ author.first_name }}</h1>

    <p>
      {% if author.date_of_birth %}
        <strong>出生日期:</strong> {{ author.date_of_birth|date:"Y年m月d日" }}
      {% endif %}
      {% if author.date_of_birth and author.date_of_death %} - {% endif %}
      {% if author.date_of_death %}
        <strong>逝世日期:</strong> {{ author.date_of_death|date:"Y年m月d日" }}
      {% endif %}
    </p>

    <h3>著作</h3>
    {% if author_books %}
      <ul class="list-unstyled">
        {% for book in author_books %}
        <li class="mb-2">
          <a href="{% url 'book-detail' book.pk %}">{{ book.title }}</a>
        </li>
        {% endfor %}
      </ul>
    {% else %}
      <p>该作者暂无著作</p>
    {% endif %}
  </div>
</div>
{% endblock %}